﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Media;

namespace ATM
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            CashBox.Text = amount(CashBox.Text, 50);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            CashBox.Text = amount(CashBox.Text, 100);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            CashBox.Text = amount(CashBox.Text, 200);
        }

        private void CashBox_TextChanged(object sender, EventArgs e)
        {
            int i;
            bool a = Int32.TryParse(CashBox.Text, out i);
            if (a==false)
            {
                ToolTip mytooltip = new ToolTip();
                SystemSounds.Beep.Play();
                mytooltip.Show("Incorrect amount, please check!", CashBox);
                
            }
            
        }
        public string amount(string text, int money)
        {
            int seged = Convert.ToInt32(text);
            seged = seged + money;
            return Convert.ToString(seged);
        }

        private void OkButton_Click(object sender, EventArgs e)
        {
            SystemSounds.Exclamation.Play();
        }

        
        
    }
}
